import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/HomeView.vue";

Vue.use(VueRouter);

const routes = [
  // 引导页
  {
    path: '/lead',
    name: 'Lead',
    component: () => import('../views/Lead.vue'),
  },
  // 注册
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue'),
  },
  // 登录
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue'),
  },
  // 评论页
  {
    path: '/comment/:com_did?',
    name: 'comment',
    component: () => import('../views/Comment.vue'),
  },
  // 文章详情页
  {
    path: '/detail/:id?',
    name: 'detail',
    component: () => import('../views/ArticleDetail.vue'),
  },
  // map
  {
    path: '/map',
    name: 'map',
    component: () => import('../views/Map.vue'),
  },
  // home
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect: 'lead',
    children: [
      {// 首页
        path: 'index',
        name: 'Index',
        component: () => import('../views/Index.vue'),
      },
      {// 我的
        path: 'me',
        name: 'Me',
        component: () => import('../views/MeView.vue'),
      },
      {// 文章提交
        path: 'submit',
        name: 'submit',
        component: () => import('../views/Submit.vue'),
      },
      {// 分类
        path: '/horizontal',
        name: 'horizontal',
        component: () => import('../views/Horizontal.vue'),
      },
      {// 投票
        path: "vote",
        name: "vote",
        component: () => import("../views/Vote.vue"),
      },
      {// 
        path: "login",
        name: "Login",
        component: () => import("../views/Login.vue"),
      },

    ]
  },
  {
    path: '/agreement',
    name: 'Agreement',
    component: () => import('../views/Agreement'),
  },
  // 发布摄影作品
  {
    path: '/photoworks',
    name: 'PhotoWorks',
    component: () => import('../views/PhotoWorks'),
  },
  // 用户收藏的文章
  {
    path: '/usercollect',
    name: 'Usercollect',
    component: () => import('../views/Usercollect.vue'),
  },
  // 用户喜欢的文章
  {
    path: '/userlike',
    name: 'Userlike',
    component: () => import('../views/Userlike.vue'),
  },
  //用户自己的作品
  {
    path: '/production',
    name: 'Userproduction',
    component: () => import('../views/Userproduction.vue'),
  }, 
  {// 文章列表
    path: '/detailedlist/:type?/:search?',
    name: 'detailedlist',
    component: () => import('../views/DetailedList.vue'),
  },
  {
    // 关于我们
    path: "/aboutwe",
    name: "Aboutwe",
    component: () => import('../views/Aboutwe.vue'),
  },
];

const router = new VueRouter({
  // mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
